<?php

/**
 * \file
 * Classe `TextArea`.
 */

namespace pilar\SimpleFormMembers /* \cond */ ; /* \endcond */
{

/**
 * Membre d'une zone de texte long.
 *
 * \since 11/12/2008
 * \author Matthieu OVIEDO <matthieu.oviedo@gmail.com>
 */
class TextArea extends \pilar\Forms\Member {

protected function initialize() {
 parent::initialize();
 
 $this->joinField(); // Déclaration du champ principal.
}


public function guiDomNode($domDoc) {
 $domGui = $domDoc->createElement('gui');

 $domTextarea = $domDoc->createElement('textArea', ' ');
 $domTextarea->setAttribute('name', $this->globalId());
 $domTextarea->setAttribute('id', $this->globalId());
 $domTextarea->setAttribute('title', $this->get('label'));

 $domGui->appendChild($domTextarea);

 return $domGui;
}


protected function outputGuiController() { ?>
$('#<?php echo $this->globalId() ?>').html('<?php echo str_replace("\r\n", '\n', addslashes($this->value())) ?>');
<?php if($this->status() == 'invalid') { ?>
 $('#<?php echo $this->globalId() ?>').addClass('invalid');
<?php } ?>
<?php
}

} // Class.

} // Namespace.

?>
